import { LongProgressBar } from "../../player/LongProgressBar";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
//class RechargeProgressBar
    
    export  class RechargeProgressBar extends LongProgressBar
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            removeChild(_barBg);
            _barBg = null;
            _barBg = ObjCreate.createBg(0, 0, 550, 36, this, ImagesConst.ProgressBottomBg);
            addChildAt(_barBg, 0);
            this.resetLabel();
            _progressBar.x = 23;
            _progressBar.y = 13;
            return;
        }

        public /* override */ set progressBarClass(arg1: string)
        {
            var loc2=null;
            _progressBarClass = arg1;
            if (_progressBar.bitmapData) 
            {
                _progressBar.bitmapData.dispose();
            }
            var loc1=BitmapDataMap[arg1] as Object /* flash.display.BitmapData */;
            if (loc1 == null) 
            {
                loc2 = ResouceConst.getScaleBitmap(arg1);
                loc2.setSize(ProgressBarWidth, 10);
                loc1 = loc2.bitmapData;
                BitmapDataMap[arg1] = loc1;
            }
            _progressBar.bitmapData = loc1;
            return;
        }

        protected /* override */ resetLabel(): void
        {
            super.resetLabel();
            _label.y = 10;
            return;
        }

        public /* override */ isHaveProgressPoint(arg1: Boolean): void
        {
            if (arg1) 
            {
                _pointBitMap = ObjCreate.createBitmap(ImagesConst.ProgressLight, 3, -3, this);
            }
            return;
        }

        public /* override */ setValue(arg1: number, arg2: number): void
        {
            super.setValue(arg1, arg2);
            _progressBar.width = int(arg1 / arg2 * (_barBg.width - 40));
            if (_pointBitMap) 
            {
                _pointBitMap.x = _progressBar.width + 3;
            }
            return;
        }
    }
